<?
include_once("./_common.php");
header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

if (iconv("cp949", "cp949", $q) == $q)
    $q = iconv("cp949", "utf-8", $q);
    
echo "<items>\n";
if ($q) {
    $any = "";
    if ($like)
        $any = "%";

    $sql = "	select mb_addr1, count(*) as cnt	";
    $sql .= "	from g4_write_sellhome where 1 and mb_addr1 like '".$any.$q."%'	";
    $sql .= "	group by mb_addr1 order by cnt desc, mb_addr1 limit 10	";
    
    echo $sql;
    
    $result = sql_query($sql);
    for($i=0;$row=sql_fetch_array($result);$i++) {
        if ($i>0)
            $javascript_object .= ",";
        $s = stripslashes(strip_tags($row[mb_addr1]));
        $s = str_replace("[", "", $s);
        $s = str_replace("]", "", $s);
        $s = str_replace("\n", "", $s);
        $s = str_replace("\r", "", $s);
        $str = iconv("utf-8", "cp949", $s);
        $str = $s;
        echo "<item>$str</item>\n";
    }
}
echo "</items>";
?>